package org.example.library_management_system.enums;

public enum BookStatus {
    DELETED(0,"⽆效"),
    NORMAL(1,"可借阅"),
    FORBIDDEN(2,"不可借阅"),
    ;
    BookStatus(Integer code, String status) {
        this.code = code;
        this.status = status;
    }

    public static BookStatus setStatusByCode(Integer code){
        switch(code){
            case 0: return DELETED;
            case 1: return NORMAL;
            case 2:
            default:
                return FORBIDDEN;
        }
    }

    private Integer code;
    private String status;


    public Integer getCode() {
        return code;
    }

    public void setCode(Integer code) {
        this.code = code;
    }

    public String getStatus() {
        return status;
    }

    public void setStatus(String status) {
        this.status = status;
    }
}
